package com.recipedb.recipedb.service;

import com.recipedb.recipedb.entity.UserFollow;
import com.recipedb.recipedb.entity.UserFollowId;
import com.recipedb.recipedb.entity.Recipe;

import java.util.List;
import java.util.Optional;

public interface UserFollowService {

    // 基本 CRUD 操作
    UserFollow save(UserFollow entity);
    void deleteById(UserFollowId id);  // 修改参数类型
    Optional<UserFollow> findById(UserFollowId id);  // 修改参数类型
    List<UserFollow> findAll();

    // 关注关系操作
    List<UserFollow> findByFollowerId(Long followerId);
    List<UserFollow> findByFolloweeId(Long followeeId);

    // 新增功能方法
    List<Recipe> getFollowedUsersRecipes(Long followerId);
    boolean followUser(Long followerId, Long followeeId);
    boolean unfollowUser(Long followerId, Long followeeId);
    boolean isFollowing(Long followerId, Long followeeId);
    List<Long> getFollowedUserIds(Long followerId);

    // 统计方法
    long getFollowCount(Long userId);
    long getFollowerCount(Long userId);

    // 批量操作
    boolean deleteByFollowerIdAndFolloweeId(Long followerId, Long followeeId);
    List<Long> getFollowerIds(Long followeeId);
}